package com.cymal.entity.po.subject;


import com.cymal.entity.po.SObj;
import lombok.Data;

/**
 * 题目类型父类
 */
@Data
public abstract class AbstractSubject extends SObj {


    /**
     * 题目描述
     */
    private String content;


    /**
     * 题目类型
     */
    private final SubjectType subjectType;


    /**
     * 章节主键
     */
    public long charterId;


    /**
     * constructor.
     * @param subjectType 题目类型
     */
    public AbstractSubject(SubjectType subjectType) {
        this.subjectType = subjectType;
    }


    /**
     * 题目类型
     */
    public enum SubjectType {
        choose,         // 选择
        judge,          // 判断
        blank,          // 填空
        application,    // 应用
        completion,     // 代码补全
        algorithm       // 算法
    }


    /**
     * 获得key
     * @return key
     */
    public String key() {
        return this.subjectType.name() + ":" + this.getId();
    }


}
